<template>
  <div>
      <h4>添加学生</h4>
      编号：<input type="text" v-model="id" class="bg">
      姓名：<input type="text" v-model="name">
      性别：<input type="radio" v-model="sex" value="男">男
            <input type="radio" v-model="sex" value="女">女
      成绩：<input type="text" v-model="grade">
      <input type="button" value="添加" @click="add">
  </div>
</template>

<script>
export default {
  props:["stuArray"],
    data(){
      return{
        id:"",
        name:"",
        sex:"男",
        grade:""
      }
    },
    methods:{
      add(){
        this.stuArray.list.push({id:this.id,name:this.name,sex:this.sex,grade:this.grade});
        this.id = "";
        this.name = "";
        this.sex = "男";
        this.grade = "";
      }
    }
}
</script>

<style>

</style>